package tools;

import oracle.kv.KVStore;
import oracle.kv.KVStoreConfig;
import oracle.kv.KVStoreFactory;
import oracle.kv.Key;

public class DropDatabase {

	private final KVStore storeImpaire;
	private final KVStore storePaire;
	
	/**
	 * Runs the HelloBigDataWorld command line program.
	 */
	public static void main(String args[]) {
		try {
			new DropDatabase();
		} catch (RuntimeException e) {
			e.printStackTrace();
		}
	}

	/**
	 * Parses command line args and opens the KVStore.
	 */
	DropDatabase() {

		String storeName = "kvstore";
		String hostPort = "5000";
		
		String hostNameImpaire = "ari-31-207-11";
		String hostNamePaire = "ari-31-207-09";

		storeImpaire = KVStoreFactory.getStore
				(new KVStoreConfig(storeName, hostNameImpaire + ":" + hostPort));
		storePaire = KVStoreFactory.getStore
				(new KVStoreConfig(storeName, hostNamePaire + ":" + hostPort));
		for(int i = 1; i <= 1000 ; i++){
			final String keyCategoryString = "C1";
			final String keyString = "P" + i;
			storeImpaire.delete(Key.createKey(keyCategoryString, keyString));
			storePaire.delete(Key.createKey(keyCategoryString, keyString));
//			storePaire.delete(Key.createKey(keyCategoryString, keyString));
//				store2.delete(Key.createKey(keyCategoryString, keyString));
//				storelocalhost.delete(Key.createKey(keyCategoryString, keyString));
//			}
//			else {
////				store2.delete(Key.createKey(keyCategoryString, keyString));
//			}
		}
		storeImpaire.close();
//		storePaire.close();
	}

}
